package com.douwong.student.activity;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;

import com.douwong.student.fragment.ImagePagerFragment;

import java.util.ArrayList;

public class ImageActivity extends FragmentActivity {
	
	
	@Override
	protected void onCreate(Bundle arg0) {
		super.onCreate(arg0);
		Fragment fr;
		String tag = ImagePagerFragment.class.getSimpleName();
		fr = getSupportFragmentManager().findFragmentByTag(tag);
		ArrayList<String> IMAGE_URLS=getIntent().getStringArrayListExtra("imgs");
		int position=getIntent().getIntExtra("position",0);
		if (fr == null) {
			fr = new ImagePagerFragment(IMAGE_URLS,position);
		}
		getSupportFragmentManager().beginTransaction().replace(android.R.id.content, fr, tag).commit();
	}
}
